package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.*;
import cn.gson.crm.model.service.ReturngoodsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/ReturngoodsController")
public class ReturngoodsController {
    @Autowired
    ReturngoodsService returngoodsService;
    //查询当前登录人下的客户
    @RequestMapping("/ContractMethod")
    @ResponseBody
    public Map<String,Object> selectcunstomer(Integer yid, String dept){
        return returngoodsService.selectcunstomer(yid,dept);
    };
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //根据客户id查询此客户下所有订单
    public List<Order> selectorder(Integer oid){
        return  returngoodsService.selectorder(oid);
    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //根据订单id查询订单详情
    public List<OrderDetails> selectodte(Integer odet){
        return  returngoodsService.selectodte(odet);
    };
    //新增退货
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    public void savereturngoods(HttpSession session,@RequestBody ReturnGoods returnGoods){
        returngoodsService.savereturngoods(session,returnGoods);
    };
    //新增换货
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    public void saveExchagegoods(HttpSession session,@RequestBody ExchangeGoods exchangeGoods){
        returngoodsService.saveExchagegoods(session,exchangeGoods);
    }
    @RequestMapping("/selectruet")
    @ResponseBody
    public  Map<String,Object> selectruet(HttpSession session,Integer rid,Integer page, Integer size){
        return returngoodsService.selectruet(session,rid,page,size);
    };
    @RequestMapping("/ContractMethod7")
    @ResponseBody
    //退货多条件查询
    public  Map<String,Object> selectwhere(HttpSession session,Integer rid,String where,Integer page, Integer size){
        return returngoodsService.selectwhere(session,rid,where,page,size);
    };
    @RequestMapping("/ContractMethod8")
    @ResponseBody
    //根据时间查询
    public  Map<String,Object> selecttime(HttpSession session,Integer rid, String statr, String endtime,Integer page, Integer size){
        return returngoodsService.selecttime(session,rid,statr,endtime,page,size);
    };
    @RequestMapping("/ContractMethod9")
    @ResponseBody
    //查详表
    public List<ReturnDetails> selectdtat(Integer rid){
        return returngoodsService.selectdtat(rid);
    };
    @RequestMapping("/ContractMethod10")
    @ResponseBody
    public List<ReturnGoods> selecttuia(Integer rid){
        return  returngoodsService.selecttuia(rid);
    };
}
